#ifndef _ICMPEVENTARGS_HPP_
#define _ICMPEVENTARGS_HPP_

#include "jhdefs.hpp"
#include "net/SocketAddress.hpp"
#include <vector>
#include <string>
#include <algorithm>

NET_NAMESPACE_BEGIN

class CICMPEventArgs
{
public:
	CICMPEventArgs(const CSocketAddress& address, int repetitions, int dataSize, int ttl);
	virtual ~CICMPEventArgs();

	std::string hostName() const;
	std::string hostAddress() const;
	int repetitions() const;
	int dataSize() const;
	int ttl() const;
	int sent() const;
	int received() const;
	int replyTime(int index = -1) const;
	const std::string& error(int index = -1) const;
	int minRTT() const;
	int maxRTT() const;
	int avgRTT() const;
	float percent() const;

private:
	CICMPEventArgs();

	void setRepetitions(int repetitions);
	void setDataSize(int sz);
	void setTTL(int timeToLive);
	void setReplyTime(int index, int time);
	void setError(int index, const std::string& text);
	CICMPEventArgs& operator ++ ();
	CICMPEventArgs operator ++ (int);

	CSocketAddress				m_address;
	int							m_sent;
	int							m_dataSize;
	int							m_ttl;
	std::vector<int>			m_rtt;
	std::vector<std::string>	m_errors;

	friend class CICMPClient;
};



NET_NAMESPACE_END

#endif
